//
// Created by jsjxsy on 2022/8/12.
//
#include <iostream>
#include <functional>
using namespace std;
int Add(int x, int y) {
  return x + y;
}
class CStudent {
 public:
  void operator()(string strName, int nAge) {
    cout << strName << " : " << nAge << endl;
  }
};

int main(void) {
//  int (*f)(int x, int y) = Add;//函数指针
  function<int(int, int)> f = Add;//std::function
  int z = f(2, 3);
  cout << "z = " << z << endl;

  CStudent stu;
  function<void(string, int)> f2 = stu;
  f2("Mike", 12);
  stu("DJ", 10);
  return 0;
}